package org.rabbitmq.provider.user.controller;

import java.util.List;

import org.rabbitmq.provider.user.entity.UserEntity;
import org.rabbitmq.provider.user.jpa.UserJPA;
import org.rabbitmq.provider.user.server.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
*@author LSY
*Time: 2018年12月5日下午7:42:33
*
*
*/
@RestController
@RequestMapping(value = "/user")
public class UserController {

	@Autowired
	private UserJPA userJpa;
	@Autowired
	private UserService userSerivce;
	@GetMapping("/all")
	public List<UserEntity> getUsers(){
		return userJpa.findAll();
	}
	
	@GetMapping(value = "/save")
    public UserEntity save(UserEntity userEntity) throws Exception
    {
		userSerivce.save(userEntity);
        return userEntity;
    }

}
